package com.ykqx.weather.app.util.dateutil;

import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: Legolas
 * Date: 2017/6/22 0022
 */
public class DateDealUtil {

    public static Map<String, String> dealMonthDayHour(int month, int day) {

        Map<String, String> month_day = new HashMap<String, String>();

        month = month % 12 + 1;// get the real month
        month_day.put("month", dealZeroToNine(month));
        month_day.put("day", dealZeroToNine(day));

        return month_day;
    }

    public static String dealZeroToNine(int num) {
        if (num >= 1 && num <= 9) {
            return "0" + num;
        }
        return "" + num;
    }

    public static String getCurrentDayFormat1(){
        Calendar calendar = Calendar.getInstance();
        int year = calendar.get(Calendar.YEAR);
        Map month_day = DateDealUtil.dealMonthDayHour(calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
        String result =""+year+month_day.get("month")+month_day.get("day");
        return result;
    }
}
